package com.inspur.dgov.bsp.system.config;

import org.apache.commons.configuration.DatabaseConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * 数据库读取配置文件
 *
 * @Author chiyupei
 * @Date 20/5/7 上午9:39
 * @Version 1.0
 * @Description 数据库读取配置文件
 */
@Configuration
public class PropertiesDataSourceConfig {

    @Autowired
    private DataSource dataSource;

    @Bean
    public DatabaseConfiguration databaseConfiguration() {
        DatabaseConfiguration databaseConfiguration = new DatabaseConfiguration(dataSource, "sys_config", "CONFIG_TYPE", "CONFIG_KEY", "CONFIG_VALUE", "1");
        databaseConfiguration.setDelimiterParsingDisabled(true);
        return databaseConfiguration;
    }
}
